﻿using Abp.Application.Services;
using Magicodes.WeChat.Application.Configuration.SdkInfo.Dto;
using Magicodes.WeChat.SDK;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Magicodes.WeChat.Application.Configuration.SdkInfo
{
    public class WeChatSdkInfoAppService : IWeChatSdkInfoAppService
    {
        /// <summary>
        /// 获取JSSDK配置
        /// </summary>
        /// <param name="absoluteUri"></param>
        /// <returns></returns>
        public Task<JSSDKConfigOutput> GetJSSDKConfigInfo(string absoluteUri)
        {
            var result = WeChatConfigManager.Current.GetJSSDKConfigInfo(absoluteUri);
            return Task.FromResult(new JSSDKConfigOutput()
            {
                Debug = false,
                AppId = result.AppId,
                NonceStr = result.NonceStr,
                Signature = result.Signature,
                Timestamp = result.Timestamp
            });
        }
    }
}
